package com.orafl.use.comorafluse.IOC.bean;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.MethodDescriptor;
import java.util.stream.Stream;

public class IocBeans {

    public static void main(String[] args) throws IntrospectionException {
        BeanInfo beaninfo = Introspector.getBeanInfo(person.class);
        System.out.println( beaninfo.getAdditionalBeanInfo());


        System.out.println("bean 方法********************************");
        System.out.println(beaninfo.getDefaultEventIndex());


        Stream.of(beaninfo.getPropertyDescriptors()).forEach(p->{
            //p.createPropertyEditor()
            p.createPropertyEditor(Man.class);

        });

        System.out.println("bean 属性********************************");
        // bean 属性
        for (int i = beaninfo.getPropertyDescriptors().length - 1; i >= 0; i--) {
            System.out.println(beaninfo.getPropertyDescriptors()[i].toString());
            beaninfo.getPropertyDescriptors()[i].createPropertyEditor(Man.class);
        }
        System.out.println("bean 方法********************************");
        // bean 方法
        for (MethodDescriptor methodDescriptor : beaninfo.getMethodDescriptors()) {
            System.out.println(methodDescriptor.toString());
        }
    }
}
